const axios = require("axios");

const RateService = require("../../services/admin/RateService")
// const alipaySdk = require('../alipay');

const AlipaySdk = require('alipay-sdk').default
const AlipayFormData = require('alipay-sdk/lib/form').default
const RateController = {
    add: async (req, res) => {
        // console.log("这个req数据:",req.data) 
        console.log("这个req111111数据:", req.body)
        const { propname, propnumber, propemail, building, roomnumber, basics, extend, tmoney, ispay } = req.body
        await RateService.add(
            {
                propname,
                propnumber: Number(propnumber),
                propemail,
                building,
                roomnumber,
                basics: Number(basics),
                extend: Number(extend),
                tmoney: Number(tmoney),
                editTime: new Date(),
                ispay,

            })
        res.send({
            ActionType: "ok",
        })

    },
    getList: async (req, res) => {
        const result = await RateService.getList(req.params)
        // console.log(result)
        res.send({
            ActionType: "ok",
            data: result
        })
    },
    getList2: async (req, res) => {
        const result = await RateService.getList2(req.params)
        // console.log(result)
        res.send({
            ActionType: "ok",
            data: result
        })
    },
    getList3: async (req, res) => {
        const result = await RateService.getList3(req.params)
        // console.log(result)
        res.send({
            ActionType: "ok",
            data: result
        })
    },
    getListdata: async (req, res) => {
        // console.log("controller:",req.params.data)
        const result = await RateService.getListdata(req.params.data)
        res.send({
            ActionType: "ok",
            data: result
        })
    },
    
    searchGetList: async (req, res) => {
        const result = await RateService.searchGetList(req.params)
        // console.log(result)
        res.send({
            ActionType: "ok",
            data: result
        })
    },
    delList: async (req, res) => {
        await RateService.delList({ _id: req.params.id })
        res.send({
            ActionType: "delok",
        })
    },
    putList: async (req, res) => {
        // console.log("更新的人是：",req.body)
        const result = await RateService.putList(req.body)

        res.send({
            ActionType: "ok",
        })
    },
    email: async (req, res) => {
        console.log("数据是是11：", req.body)

        const result = await RateService.email(req.body)

        res.send({
            ActionType: "ok",
        })
    },
    putpayList: async (req, res) => {
        // console.log("更新的人是：",req.body)
        const result = await RateService.putList(req.body)

        res.send({
            ActionType: "ok",
        })
    },
    



}
module.exports = RateController
